<template>
  <div class="container">
    <van-nav-bar fixed title="分类" />
    <van-grid :gutter="20" :column-num="2">
      <van-grid-item  :to="'/list?index='+ index" v-for="(item,index) in list" :key="item.id" :icon="item.icon" :text="item.catename" />
   
    </van-grid>
  </div>
</template>

<script>
    export default {
    async created(){
    await this.$store.dispatch('indexList/getBannerList')
    const res = this.$store.state.indexList.indexAll
    console.log(res);
    this.list = res.allCate
    console.log(this.list);
    },
    data(){ 
      return {
        list:[]
      }
    }
    }
</script>

<style scoped lang="less">
.van-grid{
  margin-top: 40px;
}
</style>